<%@page language="java" import="com.scalar.chiptrack.finance.purchaseorder.ReceivingsTransaction,
                                com.scalar.chiptrack.users.Functionality,
                                com.scalar.chiptrack.users.User" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<chiptrack:checkLogon sourcePage="/jsp/finance/auto_receiving_and_invoice_search.jsp"/>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<SCRIPT language="JavaScript">
function submit()
{
    //document.receivingsTransactionForm.submit();
    return true;
}
function reset()
{
    document.receivingsTransactionForm.reset();
}
function addAutoReceivings()
{
    document.receivingsTransactionForm.action='<%=chipTracContext%>/autoReceivingAndInvoice.do?action=new';
    document.receivingsTransactionForm.submit();
}

function viewAutoReceivingsTransaction( receiptNumber )
{
   document.receivingsTransactionForm.action=" <%=chipTracContext%>/autoReceivingAndInvoice.do?action=view&receiptNumber="+receiptNumber;
   document.receivingsTransactionForm.submit();
}
</SCRIPT>

</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<!-- Top Header Start-->

<%@include file="/jsp/includes/header.jsp"  %>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
    <TR>
	    <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

<%@include file="/jsp/finance/purchase_order_menu.jsp" %>

        </TD>
<!-- end of the side navigations -->

        <TD bgcolor="#ffffff">
            <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8>
        </TD>
        <TD bgcolor="#ffffff">
            <IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2>
        </TD>
        <TD valign="top" width="100%">

        <!-- SiteMap Tag >
< c h i p t r a ck : s i t e m a p  s t y l e C l a s s = " N A ri a l S "  /  -->

<chiptrack:permission functionality='<%=Functionality.RECEIVINGS_TRANSACTION%>'
    action='<%=User.USER_ACTION_VIEW%>' styleClass="NArialL" >
</chiptrack:permission>
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>

<!-- from here your body starts -->
<P>
    <TABLE BORDER="0" WIDTH="100%">
        <html:form name="receivingsTransactionForm" action="/autoReceivingAndInvoice.do?action=search" method="post" type="com.scalar.chiptrack.finance.purchaseorder.forms.ReceivingsTransactionForm" onsubmit= "javascript: return submit()">
        <TR>
            <TD WIDTH="100%" class="NArialW"><P ALIGN="CENTER">Auto Receipts Search
            </TD>
        </TR>
        <TR>
            <TD WIDTH="100%">&nbsp;</TD>
        </TR>
        <TR>
            <TD><chiptrack:info styleClass="NArialL" /></TD>
        </TR>
        <TR>
            <TD><chiptrack:errors styleClass="NArialL" /></TD>
        </TR>
        <TR>
            <TD><chiptrack:moreErrorInfo styleClass="NArialL" /></TD>
        </TR>
        <TR>
	        <TD WIDTH="100%">
                <TABLE BORDER="0" WIDTH="100%">
				<TR>
					<TD WIDTH="100%">
      <nested:nest property="receivingsTransaction">
						<TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
							<TR>
								<TD WIDTH="6%">&nbsp;</TD>
								<TD WIDTH="15%">Receipt Number:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="26%">
                                    <html:text property="receiptNumber" styleClass="txfield" size="21" maxlength="17"/>
                                </TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="10%" nowrap>Vendor Name:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="20%">
                                    <html:text property="vendorName" styleClass="txfield" size="25" maxlength="65"/>
       							</TD>
								<TD WIDTH="6%">&nbsp;</TD>
							</TR>
							<TR>
								<TD WIDTH="6%">&nbsp;</TD>
								<TD WIDTH="15%">Year:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="26%">
                                        <html:select property="year" styleClass="txfield" >
                                            <html:option value="" >--select--</html:option>
                                            <html:options collection = "YearList" property="value" labelProperty="label"/>
                                        </html:select>
                                </TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="5%">&nbsp;</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="39%">&nbsp;</TD>
								<TD WIDTH="6%">&nbsp;</TD>
							</TR>
							<TR>
								<TD COLSPAN="9">&nbsp;</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">
						<TABLE BORDER="0" WIDTH="95%" CLASS="NArialL" align="center">
							<TR>
								<TD COLSPAN="2"><P ALIGN="RIGHT">
                                <%--<A href="javascript:submit()" onmouseover="window.status='Click here to Search Auto Receivings Transaction Details';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/search.gif" ALIGN="BOTTOM" BORDER="0" ></a>--%>
                                <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click here to Search Auto Receivings Transaction Details';return true" onmouseout="window.status='';return true" title="Click here to Search for Auto Receivings Transaction Details"/>
                                </TD>
								<TD WIDTH="47%"><A href="javascript:reset()" onmouseover="window.status='Click here to Reset';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/reset.gif" ALIGN="BOTTOM" BORDER="0"></A></TD>
							</TR>
							<TR>
								<TD COLSPAN="2">&nbsp;</TD>
								<TD WIDTH="47%">&nbsp;</TD>
							</TR>
							<TR>
								<TD COLSPAN="3">To add a new Auto Receivings Transaction, Please
                                <chiptrack:restrictedLink functionality="<%=Functionality.RECEIVINGS_TRANSACTION%>"
                                      action="<%=User.USER_ACTION_MODIFY%>"href="javascript:addAutoReceivings()" onmouseover="window.status='Click here To add a new Auto Receivings Transaction';return true" onmouseout="window.status='';return true">Click Here
                                   </chiptrack:restrictedLink>
                                </TD>
								<!-- <TD WIDTH="47%">&nbsp;</TD> -->
							</TR>
							<TR>
								<TD WIDTH="49%">&nbsp;</TD>
								<TD WIDTH="4%">&nbsp;</TD>
								<TD WIDTH="47%">&nbsp;</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
            <logic:present name="ReceivingsTransactionList">
				<TR>
						<TABLE BORDER="0" WIDTH="95%" CLASS="NArialL" align="center">
							<TR>
								<TD WIDTH="25%" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Receipt Number</FONT>
								</TD>
								<!--TD WIDTH="40%" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">PO Number</FONT>
								</TD-->
                                <TD WIDTH="15%" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Vendor Name</FONT>
								</TD>
                                <TD WIDTH="20%" BGCOLOR="#993333" NOWRAP >
									<P ALIGN="CENTER"><FONT COLOR="white">Action</FONT>
								</TD>
							</TR>
                            <logic:iterate id="ReceivingsTransaction" name="ReceivingsTransactionList" indexId="index">
                                <TR <% if( Integer.parseInt( index.toString() ) % 2 == 0 ){ %> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> >
                                    <TD WIDTH="25%" >
                                        <P ALIGN="LEFT">
                                        &nbsp;&nbsp;<bean:write name="ReceivingsTransaction" property="receiptNumber" />
                                    </TD>
                                    <%--TD WIDTH="35%">
                                        <P ALIGN="LEFT">
                                         &nbsp;&nbsp;<bean:write name = "ReceivingsTransaction" property="selectedPONumber"/>
                                    </TD--%>
                                    <TD WIDTH="20%">
                                        <P ALIGN="LEFT">
                                        <!-- Storing the PO Number in SelectedPoNumber property as it only needs to be displayed -->
                                        &nbsp;&nbsp;<bean:write name = "ReceivingsTransaction" property="vendorName"/>
                                    </TD>
                                    <TD WIDTH="20%">
                                        <P ALIGN="CENTER">
                                        <chiptrack:restrictedLink functionality="<%=Functionality.RECEIVINGS_TRANSACTION%>"
                                            action="<%=User.USER_ACTION_VIEW%>"
                                            href='<%="javascript:viewAutoReceivingsTransaction(\'" +
                                            ( ( ReceivingsTransaction ) ReceivingsTransaction).getEncodedReceiptNumber() +"\');" %>' onmouseover="window.status='Click here to view Auto Receivings Transaction Details';return true" onmouseout="window.status='';return true">
                                            View
                                        </chiptrack:restrictedLink>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <a href="<%= chipTracContext %>/autoReceivingAndInvoice.do?action=edit&receiptNumber=<bean:write name = "ReceivingsTransaction" property="encodedReceiptNumber"/>" onmouseover="window.status='Click here to Modify Auto Receiving Transactions Details';return true" onmouseout="window.status='';return true">Modify</a>
                                    </TD>
                                </TR>
                            </logic:iterate>
            			</TABLE>
				</TR>
            </logic:present>
        </nested:nest>
    </html:form>
			</TABLE>
</TR>


</TABLE>

</TD></TR></TABLE>

<!-- Your Work area ends here -->
<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</html>